package com.lottery.material.dao.portal.portaluser;

import com.lottery.material.dao.base.BaseDao;
import com.lottery.material.dto.portal.PortalUserInfoDto;
import com.lottery.material.entity.portaluser.PortalUserInfo;
import org.springframework.data.jpa.repository.Query;

import java.util.Optional;

public interface PortalUserInfoDao extends BaseDao<PortalUserInfo, Integer> {
    Optional<PortalUserInfo> findByLoginPhoneNumberAndUserStatusNot(String phoneNumber,Integer userStatus);
    Optional<PortalUserInfo> findByUserId(String userId);

    /**
     * 查我的用户信息
     * @Author 焦阳
     * @param userId
     * @return
     */
    @Query(value = "select p from PortalUserInfo p where p.userId =:userId")
    PortalUserInfoDto findMyPortalUserInfoDtoByUserId(String userId);

    /**
     * 查他人的用户信息
     * @Author 焦阳
     * @param hisUserId
     * @return
     */
//    @Query(value = "select p.id,p.userId,p.nickName,p.headPortraitUrl,p.signature,p.isAuth,p.isExpert," +
//            "p.publishTotal,p.followTotal,p.fansTotal,1,count(c.circleId) from PortalUserInfo p left join CircleMemberInfo c on c.userId=p.userId where p.userId =:hisUserId")
//    PortalUserInfoDto findPortalUserInfoDtoByUserId(String hisUserId);

}
